package com.javalong.affairs.activity;

import android.content.Context;
import android.os.Bundle;
import android.os.Handler;

import com.javalong.affairs.R;
import com.javalong.affairs.common.ServiceLocator;
import com.javalong.affairs.common.UIHandler;
import com.javalong.affairs.manager.IntentManager;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ContentView;
import com.tencent.android.tpush.XGPushManager;

@ContentView(R.layout.activity_splash)
public class SplashActivity extends BaseActivity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		ViewUtils.inject(this);
		initApplication();
	}

	private void initApplication() {
		initCommonComponent();
		initXG();
		new Handler().postDelayed(new Runnable() {
			@Override
			public void run() {
				IntentManager.doActivity(SplashActivity.this,
						StartActivity.class);
			}
		}, 10);
	}

	private void initXG() {
		Context context = getApplicationContext();
		XGPushManager.registerPush(context);	
	}

	private void initCommonComponent() {
		ServiceLocator.GetInstance().register(new UIHandler());
	}

}
